<template>
  <div class="xtx-pay-page">
    <div class="container">
      <el-breadcrumb class="bread" :separator-icon="ArrowRight">
        <el-breadcrumb-item to="/">首页</el-breadcrumb-item>
        <el-breadcrumb-item to="/cart">购物车</el-breadcrumb-item>
        <el-breadcrumb-item >支付结果</el-breadcrumb-item>
      </el-breadcrumb>
      <!-- 支付结果 -->
      <div class="pay-result" v-if="order">
        <span v-if="route.query.payResult" class="iconfont icon-queren2 green"></span>
        <span v-else class="iconfont icon-shanchu red" ></span>
        <p class="tit">订单支付{{$route.query.payResult?'成功':'失败'}}</p>
        <p class="tip">我们将尽快为您发货，收货期间请保持手机畅通</p>
        <p>支付方式：<span>支付宝支付</span></p>
        <p>支付金额：<span class="red">¥{{order.payMoney}}</span></p>
        <div class="btn">
          <MyButton @click="router.push('/member/order')" type="primary" style="margin-right:20px">查看订单</MyButton>
          <MyButton @click="router.push('/')" type="gray">进入首页</MyButton>
        </div>
        <p class="alert">
          <span class="iconfont icon-tip"></span>
          温馨提示：小兔鲜儿不会以订单异常、系统升级为由要求您点击任何网址链接进行退款操作，保护资产、谨慎操作。
        </p>
      </div>
    </div>
  </div>
</template>
<script setup>
import { ref } from 'vue'
import { findOrder } from '@/api/order'
import { useRoute, useRouter } from 'vue-router'
import { ArrowRight } from '@element-plus/icons-vue'
import MyButton from '@/components/my-button'
  const router = useRouter()
  const order = ref(null)
  const route = useRoute()
  findOrder(route.query.orderId).then(data => {
    order.value = data.result
  })
</script>
<style scoped lang="less">
.bread{
    display: flex;
    padding: 25px 10px;
    // ul li:last-child {}
    // 先找到父元素，找到所有的子元素，找到最后一个，判断是不是LI，是就是选中，不是就是无效选择器
    // ul li:last-of-type {}
    // 先找到父元素，找到所有的类型为li的元素，选中最后一个
    &-item {
      a {
        color: #666;
        transition: all .4s;
        &:hover {
          color: @mainColor;
        }
      }
    }
    i {
      font-size: 12px;
      margin-left: 5px;
      margin-right: 5px;
      line-height: 22px;
      // 样式的方式，不合理
      // &:last-child {
      //   display: none;
      // }
    }
  }
.pay-result {
  padding: 100px 0;
  background: #fff;
  text-align: center;
  > .iconfont {
    font-size: 100px;
  }
  .green {
    color: #1dc779;
  }
  .red {
    color: @priceColor;
  }
  .tit {
    font-size: 24px;
  }
  .tip {
    color: #999;
  }
  p {
    line-height: 40px;
    font-size: 16px;
  }
  .btn {
    margin-top: 50px;
  }
  .alert {
    font-size: 12px;
    color: #999;
    margin-top: 50px;
  }
}
</style>